from base import Base
from selenium.webdriver.common.by import By
class Page(Base):
    def ssk(self):
        print('点击搜索框')
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("搜索菜谱")')
        ele=self.find_ele(loc)
        return ele
    def shuru(self):
        print('输入搜索内容')
        loc=(By.CLASS_NAME,'android.widget.EditText')
        ele=self.find_ele(loc)
        return ele
    def djss(self):
        print('点击搜索按钮')
        loc=(By.XPATH,'//android.widget.TextView[@text="搜索"]')
        ele=self.find_ele(loc)
        return ele
    def tp(self):
        print('点击图片')
        loc=(By.XPATH,'(//android.widget.ImageView[@resource-id="com.xiachufang:id/common_photo_image_view"])[1]')
        ele=self.find_ele(loc)
        return ele
    def tc(self):
        print('手动点击退出菜谱详情页')
        # self.find_ele_wait((By.ANDROID_UIAUTOMATOR,'new UiSelector().description("返回")'))
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().description("返回")')
        # ele=self.find_ele_wait(loc)
        ele=self.find_ele(loc)
        return ele
    def tc1(self):
        print('退出菜谱列表')
        loc=(By.ACCESSIBILITY_ID,'返回')
        ele = self.find_ele(loc)
        return ele
    def sc(self):
        print('点击收藏按钮')
        loc=(By.ID,'com.xiachufang:id/recipe_bto_nav_bar_collect')
        ele=self.find_ele(loc)
        return ele
    def pl(self):
        print('点击评论')
        loc=(By.ID,'com.xiachufang:id/recipe_bto_nav_bar_comment')
        ele=self.find_ele(loc)
        return ele
    def dy(self):
        print('断言综合是否存在')
        loc = (By.ANDROID_UIAUTOMATOR, 'new UiSelector().text("综合")')
        ele = self.find_ele(loc)
        return ele
    def dy1(self):
        print('断言这个页面是空的是否存在')
        loc=(By.ID,'com.xiachufang:id/tv_load_status_major')
        ele=self.find_ele(loc)
        return ele
    def dy2(self):
        print('断言儿童是否存在')
        loc = (By.ANDROID_UIAUTOMATOR, 'new UiSelector().text("儿童")')
        ele = self.find_ele(loc)
        return ele
    def dy3(self):
        print('断言清蒸是否存在')
        loc = (By.XPATH, '//android.widget.TextView[@resource-id="com.xiachufang:id/tv_content" and @text="清蒸"]')
        ele = self.find_ele(loc)
        return ele
    def dy4(self):
        print('断言家常是否存在')
        loc = (By.XPATH, '//android.widget.TextView[@resource-id="com.xiachufang:id/tv_content" and @text="家常"]')
        ele = self.find_ele(loc)
        return ele
